package com.kmust.dream.wanderingdream.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kmust.dream.wanderingdream.comm.pojo.ResultBean;
import com.kmust.dream.wanderingdream.product.entity.ProductDetailImage;
import com.kmust.dream.wanderingdream.product.service.ProductDetailImageService;
import com.kmust.dream.wanderingdream.product.mapper.ProductDetailImageMapper;
import com.kmust.dream.wanderingdream.product.utils.ReturnUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.List;

/**
 *
 */
@Service
@Transactional
public class ProductDetailImageServiceImpl extends ServiceImpl<ProductDetailImageMapper, ProductDetailImage>
implements ProductDetailImageService{

    @Override
    public ResultBean getAllDetailImage(Integer productId) {
        return ReturnUtils.getList(this.list(new QueryWrapper<ProductDetailImage>().eq("product_id",productId)));
    }

    @Override
    public ResultBean addDetailImage(ProductDetailImage productDetailImage) {
        return ReturnUtils.add(this.save(productDetailImage));
    }

    @Override
    public ResultBean addDetailImageBatch(List<ProductDetailImage> images) {
        return ReturnUtils.add(this.saveBatch(images));
    }
}




